package cn.lavenir.fyai.rag.stream;

import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author dinghq
 * @description  隔离聊天记忆 为每个用户的新聊天或者不同的用户区分聊天记忆
 * @date 2025/7/8
 */
@Configuration
public class SeparateChatAssistantConfig {
    @Bean("chatMemoryProvider")
    ChatMemoryProvider chatMemoryProvider() {
        return memoryId -> MessageWindowChatMemory.builder()
                .id(memoryId)
                .maxMessages(10)
                .build();
    }
}
